#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
struct Node {
    int x, y;
};

const int maxn = 101;
int a[maxn][maxn];
int book[maxn][maxn];
int fx[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};//四连通 顺时针方向
int n, m;
int sx, sy, ex, ey;
/**
 * dp[x][y]表示(x,y)与源点之间的距离
 */
int dp[maxn][maxn];


int bfs(int x, int y) {
    int cnt = 0;
    queue<Node> Q;
    Q.push({x, y});
    book[x][y] = 1;
    dp[x][y] = 0;//源点到自身的距离为0
    while (Q.size()) {
        Node head = Q.front();
        int k = dp[head.x][head.y];//队列头P结点距离源点为k
        for (int i = 0; i < 4; i++) {
            int nx = head.x + fx[i][0];
            int ny = head.y + fx[i][1];
            if (nx < 0 || nx >= n || ny < 0 || ny >= m || book[nx][ny] == 1 || a[nx][ny] == 1)continue;
            Q.push({nx, ny});
            book[nx][ny] = 1;
            dp[nx][ny] = k + 1;//P扩张的点都是k+1
        }
        Q.pop();
        ++cnt;
    }
    return cnt;
}


int main() {
    freopen("A.in", "r", stdin);
    while (cin >> n >> m) {
        memset(a, 0, sizeof(a));
        memset(book, 0, sizeof(book));
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++) {
                cin >> a[i][j];
            }
        cin >> sx >> sy >> ex >> ey;//源点S(sx,sy) 终点E(ex,ey)
        --sx, --sy, --ex, --ey;
        memset(dp, -1, sizeof(dp));
        dp[sx][sy] = 0;
        bfs(sx, sy);
        if (dp[ex][ey] == -1)
            cout << "No Way!" << endl;
        else
            cout << dp[ex][ey] << endl;
    }


    return 0;
}
